[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
##############################################################################
###+-------+##################################################################
#+-| RAT() |----------------------------------------------+###################
#| +-------+ Returns the relative position of fine_string |###################
#+--------------------------------------------------------+###################
##############################################################################
##############################################################################
#+--| Summary |----------------+##############################################
#|     #INCLUDE string.hdr     |##############################################
#+-----------------------------+##############################################
##############################################################################
##############################################################################
#+--| Syntax |----------------------------------------------------------+#####
#|     FUNCTION UINT rat PROTOTYPE                                      |#####
#|      PARAMETERS CONST CHAR find_string, CONST CHAR source_string     |#####
#+----------------------------------------------------------------------+#####
##############################################################################
##############################################################################
#########+---| Description |----------------------------------------+#########
#########| The rat() function returns the relative position of the  |#########
#########| first occurrence of find_string within source_string     |#########
#########| starting from the right most character of source_string. |#########
#########| If no match is found, a zero is returned.  The first     |#########
#########| character in source_string is considered to be position  |#########
#########| one.                                                     |#########
#########+----------------------------------------------------------+#########
##############################################################################
##############################################################################
#########+--| Example 1 |-------------------------------------------+#########
#########| *    Change the extension of a filename from             |#########
#########| *    .dbf to .bak.                                       |#########
#########|                                                          |#########
#########| n = substr(dbf(),1,rat( ".",dbf())) + ".bak"             |#########
#########+----------------------------------------------------------+#########
##############################################################################
##############################################################################
#########+--| Example 2 |-------------------------------------------+#########
#########| *    Which character is closer to the end of the string? |#########
#########|                                                          |#########
#########| IF rat( c[ q ], a_str ) >= rat( d[ q ], a_str )          |#########
#########|     RETURN c[ q ]                                        |#########
#########| ENDIF                                                    |#########
#########| RETURN d[ q ]                                            |#########
#########+----------------------------------------------------------+#########
##############################################################################

See Also: stuff() substr()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson